package handler

import (
	"fmt"
	"math/rand"
	"strconv"
	"travel/project/global"
	"travel/project/intdler/models"
	"travel/project/mysql"
	"travel/project/pkg"
)

func SendSms() {
	var user models.User
	code := rand.Intn(9000) + 1000

	sms, _ := pkg.SendSms(user.Mobile, strconv.Itoa(code))
	if *sms.Body.Code != "OK" {
		fmt.Println(*sms.Body.Message)
	}
	if *sms.Body.Code == "2" {
		fmt.Println("当前账号已被登录")
	}

	global.RDB.Get(mysql.Ctx, "SendSms"+user.Mobile)

}
